// https://nuxt.com/docs/api/configuration/nuxt-config

import { defineNuxtConfig } from 'nuxt/config'
export default defineNuxtConfig({
  telemetry:false,
  runtimeConfig: {
    // The private keys which are only available server-side 只运行在服务端  通过这个判断是服务端还是客户端, 服务端还是没有window
    apiSecret: {
      env:'service',
    } , 
    // Keys within public are also exposed client-side  + service  F5 会运行服务端+客户端  ctrl+v 仅仅是客户端
    public: {
      apiBase: '/api',
      $target:"http://101.132.181.9:3000/",
      // $target:"http://101.132.181.9/",
    }
  },
  modules: [
    '@pinia/nuxt',
    '@element-plus/nuxt',
    // '@nuxtjs/axios',
    // '@nuxtjs/proxy',  

  ],
  nitro: {
    // devProxy: {
    //     '/api': {
    //         target: 'http://101.132.181.9:3000/',
    //         changeOrigin: true,
    //     },
    // }
},
  // axios: {
  //   proxy: true
  //  },
  // proxy: {
  //   '/api': {
  //     target: 'http://101.132.181.9:3000/', // 线上后端地址
  //     changeOrigin: true, //允许跨域
  //     pathRewrite: {
  //       '^/api': ''
  //     }
  //   },
  //   '/first': {
  //     target: 'https://blog.51cto.com/activity-first-publish/show-popover', // 线上后端地址
  //     changeOrigin: true, //允许跨域
  //     pathRewrite: {
  //       '^/first': ''
  //     }
  //   },

  //   '/apipost': {
  //     target: 'https://ug.baidu.com/mcp/pc/pcsearch/', // 线上后端地址
  //     changeOrigin: true, //允许跨域
  //     pathRewrite: {
  //       '^/apipost': ''
  //     }
  //   }
  // },
 
  elementPlus: {
    icon: 'ElIcon', // icon前缀 <el-icon><el-icon-close /></el-icon>  
    // importStyle: 'scss',
    // themes: ['dark'],
  },
  css:['element-plus/dist/index.css',],
  nitro: {
    devProxy: {
      '/api': {
        // target: 'http://localhost:3000/', // 本地后端地址
        target: 'http://101.132.181.9:3000/', // 线上后端地址
        changeOrigin: true, //允许跨域
        pathRewrite: {
          '^/api': ''
        },
      },
    }
  },
})
